package cn.edu.nwsuaf.studentcenter.pojo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * College entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "college", catalog = "exam")
public class College implements java.io.Serializable {

	// Fields

	private String collegeNo;
	private String coolegeName;
	private Set<Major> majors = new HashSet<Major>(0);
	private Set<Teacher> teachers = new HashSet<Teacher>(0);

	// Constructors

	/** default constructor */
	public College() {
	}

	/** minimal constructor */
	public College(String collegeNo, String coolegeName) {
		this.collegeNo = collegeNo;
		this.coolegeName = coolegeName;
	}

	/** full constructor */
	public College(String collegeNo, String coolegeName, Set<Major> majors,
			Set<Teacher> teachers) {
		this.collegeNo = collegeNo;
		this.coolegeName = coolegeName;
		this.majors = majors;
		this.teachers = teachers;
	}

	// Property accessors
	@Id
	@Column(name = "college_no", unique = true, nullable = false, length = 50)
	public String getCollegeNo() {
		return this.collegeNo;
	}

	public void setCollegeNo(String collegeNo) {
		this.collegeNo = collegeNo;
	}

	@Column(name = "coolege_name", nullable = false, length = 50)
	public String getCoolegeName() {
		return this.coolegeName;
	}

	public void setCoolegeName(String coolegeName) {
		this.coolegeName = coolegeName;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "college")
	public Set<Major> getMajors() {
		return this.majors;
	}

	public void setMajors(Set<Major> majors) {
		this.majors = majors;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "college")
	public Set<Teacher> getTeachers() {
		return this.teachers;
	}

	public void setTeachers(Set<Teacher> teachers) {
		this.teachers = teachers;
	}

}